import { defineConfig } from 'vite'
import type { ProxyOptions } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import ElementPlus from 'unplugin-element-plus/vite'
import { resolve } from 'path'
// https://vite.dev/config/
export default defineConfig({
  plugins: [AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),vue(),ElementPlus({})],
  base: '/tools/copycode/',
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost/tools/copycode',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      } as ProxyOptions
    }
  },
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  }
})
